package com.gxar.quick.ar.server.base.common.enums.protocol;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;


/**
 * 内容元素类型
 *
 * @author zxh
 * @version 1.0
 * @created 2024/01/02.
 */
@Getter
public enum ArMediaTypeEnum {

    GLTF("gltf", "3d模型"),
    VIDEO("video", "视频"),
    IMAGE("image", "图片"),
    MUSIC("music", "音乐"),
    ;

    private final String name;
    private final String desc;

    ArMediaTypeEnum(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    @JsonCreator
    public static ArMediaTypeEnum getByName(String name) {
        Optional<ArMediaTypeEnum> targetEnum = Arrays.stream(ArMediaTypeEnum.values()).filter(e -> e.getName().equals(name)).findFirst();
        return targetEnum.orElse(null);
    }

}
